cmake_minimum_required(VERSION 3.0)
project(Rpp_test)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../../cmake)
set(ROCM_PATH /opt/rocm CACHE PATH "default ROCm installation path")
list(APPEND CMAKE_PREFIX_PATH ${ROCM_PATH}/hip ${ROCM_PATH})
find_package(hip REQUIRED)
find_package(OpenCV REQUIRED)
find_package(AMDRPP QUIET)

if(NOT hip_FOUND)
	message("-- ${Yellow}Rpp_test requires hip, Found ${hip_INCLUDE_DIRS}/hip ${hip_LIBRARIES} ${ColourReset}")
endif()

if (hip_FOUND)
    set(COMPILER_FOR_HIP ${ROCM_PATH}/bin/hipcc)
    set(CMAKE_CXX_COMPILER ${COMPILER_FOR_HIP})

    include_directories(${HIP_INCLUDE_DIRS} ${HIP_INCLUDE_DIRS}/hip)
    include_directories(${OpenCV_INCLUDE_DIRS})
    include_directories(${ROCM_PATH}/include ${ROCM_PATH}/rpp/include /usr/local/include)
    link_directories(${ROCM_PATH}/lib ${ROCM_PATH}/rpp/lib/ /usr/local/lib)

    add_executable(BatchPD_hip_pkd3 BatchPD_hip_pkd3.cpp)
    add_executable(BatchPD_hip_pln1 BatchPD_hip_pln1.cpp)
    add_executable(BatchPD_hip_pln3 BatchPD_hip_pln3.cpp)
    # add_executable(Single_hip Single_hip.cpp)
    add_executable(uniqueFunctionalities_hip uniqueFunctionalities_hip.cpp)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -DHIP_COMPILE=1 -DRPP_BACKEND_HIP=1 -std=c++11")
    target_link_libraries(BatchPD_hip_pkd3 ${OpenCV_LIBS} -lamd_rpp ${HIP_LIBRARIES} pthread boost_filesystem boost_system hip::host)
    target_link_libraries(BatchPD_hip_pln1 ${OpenCV_LIBS} -lamd_rpp ${HIP_LIBRARIES} pthread boost_filesystem boost_system hip::host)
    target_link_libraries(BatchPD_hip_pln3 ${OpenCV_LIBS} -lamd_rpp ${HIP_LIBRARIES} pthread boost_filesystem boost_system hip::host)
    # target_link_libraries(Single_hip ${OpenCV_LIBS} -lamd_rpp ${HIP_LIBRARIES} pthread boost_filesystem boost_system hip::host)
    target_link_libraries(uniqueFunctionalities_hip ${OpenCV_LIBS} -lamd_rpp ${HIP_LIBRARIES} pthread boost_filesystem boost_system hip::host)
endif()